15000 REM ==========================
15001 REM Directory listing
15002 REM
15003 REM INPUT:  DIREC$ - DIRECTORY
15004 REM                  WITH MASK
15004 REM OUTPUT: FL$ - FILE LIST
15005 REM         LC  - FILE COUNT
15006 REM ==========================
15010 SHELL "DIR "+DIREC$+" > DIR.LST"
15020 OPEN "DIR.LST" FOR INPUT AS #10
15030 REM COUNT THE FILES FIRST
15040 LC = 0
15050 WHILE(1=1)
15060   LINE INPUT#10, L$
15070   IF MID$(L$,1,1) <> " " AND MID$(L$,1,1) <> "." AND LEN(L$) > 0 THEN LC = LC + 1
15075   IF LC > 0 AND MID$(L$,1,1) = " " THEN GOTO 15090
15080 WEND
15090 CLOSE #10
15093 IF C15000 = 1 THEN ERASE FL$
15097 C15000 = 1
15100 DIM FL$(LC)
15110 OPEN "DIR.LST" FOR INPUT AS #10
15120 IC = 1
15130 WHILE(IC <= LC)
15140   LINE INPUT#10, L$
15150   IF MID$(L$,1,1) = " " OR MID$(L$,1,1) = "." OR LEN(L$) < 10 THEN GOTO 15210
15160   JC = INSTR(L$, " "):FL$(IC) = MID$(L$,1,JC-1)
15170   WHILE(MID$(L$,JC,1) = " "):JC = JC + 1:WEND
15180   IF (MID$(L$,JC,1) < "9" AND MID$(L$,JC,1) > "0") OR MID$(L$,JC,1) = "<" THEN GOTO 15200
15190   KC = INSTR(JC, L$, " "):FL$(IC) = FL$(IC) + "." + MID$(L$,JC,KC-JC)
15200   IC = IC + 1
15210 WEND
15220 CLOSE #10
15230 SHELL "DEL DIR.LST"
15240 RETURN
15500 REM ==============================
15501 REM Retrieve the current directory
15502 REM OUTPUT - CURDIR$ Current dir
15503 REM ==============================
15510 SHELL "CD > DIR.LST"
15520 OPEN "DIR.LST" FOR INPUT AS #10
15530 LINE INPUT#10, CURDIR$
15540 CLOSE #10
15550 SHELL "DEL DIR.LST"
15560 RETURN
